@extends('layouts.layouts')
@section('title')
<title>后台首页</title>
@endsection
@section('content')
<link rel="stylesheet" href="/lib/layer/theme/default/layer.css"/>
<script type="text/javascript" src="/lib/layer/layer.js"></script>
<div class="content">
    <div class="header">
        <ul class="breadcrumb">
            <li><a href="/courseLearn/card">活动列表</a></li>
            <li class="active">活动记录</li>
        </ul>
    </div>

    <div class="main-content">
        <div class="btn-toolbar list-toolbar">
            <form class="form-inline" action="" method="get">
                <div class="form-group">
                    <input type="text" class="form-control" name="name" placeholder="用户" value="">
                </div>
                <button type="submit" class="btn btn-default">筛选</button>
            </form>
        </div>
        <div class="row">
            <div class="col-sm-12 col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading no-collapse">活动列表</div>
                    <table class="table table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>用户名</th>
                            <th>开始体验时间</th>
                            <th>有效天数</th>
                            <th>是否失效</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($cardRecords as $record)
                        <tr>
                            <td>{{$record->id}}</td>
                            <td>{{$record->user?$record->user->name:''}}</td>
                            <td>{{date('Y-m-d H:i:s',strtotime($record->start_time))}}</td>
                            <td>{{$record->experience_time}}天</td>
                            <td>{{(time()-strtotime($record->start_time))/86400>3?'失效':'有效'}}</td>
                        </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        {{$cardRecords->render()}}
    </div>
</div>
@endsection